//
//  ViewController.m
//  08-绘制文字和图片
//
//  Created by J on 16/2/23.
//  Copyright © 2016年 J. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *label;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSMutableDictionary* textAtr = [NSMutableDictionary dictionary];
    //    设置文字颜色
    textAtr[NSFontAttributeName] = [UIFont systemFontOfSize:15];
    textAtr[NSForegroundColorAttributeName] = [UIColor orangeColor];
    //空心文字
    textAtr[NSStrokeWidthAttributeName] = @5 ;
    textAtr[NSStrokeColorAttributeName] = [UIColor blackColor] ;//same as foreground color覆盖了字体颜色
    NSShadow* shadow = [NSShadow new];
    shadow.shadowBlurRadius = 10.0;
    shadow.shadowOffset = CGSizeMake(5, 5);
    shadow.shadowColor = [UIColor purpleColor];
    textAtr[NSShadowAttributeName] = shadow;
    
    
    NSAttributedString * attstr = [[NSAttributedString alloc]initWithString:@"NSAttributedString" attributes:textAtr];

    _label.attributedText = attstr;
    [_label sizeToFit];//只对普通文本text有效 attributedText无效


}


@end
